by the skin of (someone's) teeth

Translations
de justesse
Definitions
A phrase used to describe a situation where someone narrowly escapes a difficult or dangerous situation, achieving success or survival by a very small margin.